package model
{
import flash.events.EventDispatcher;
import model.entities.UserEntity;
import model.events.LoginEvent;
/**
 * @author daichangxin
 */
public class UserModel extends EventDispatcher implements IUserModel
{
	private var _userEntity:UserEntity;
	
	public function UserModel()
	{
		_userEntity = new UserEntity();
	}
	
	public function login(userName:String, password:String):void
	{
		//test数据接收完成
		_userEntity.decode({"userName":userName, "level":4, "password":password});
		
		this.dispatchEvent(new LoginEvent(LoginEvent.SUCCESS));
		//this.dispatchEvent(new LoginEvent(LoginEvent.FAIL));
	}
	
	public function getUserEntity():UserEntity
	{
		return _userEntity;
	}
}
}
